/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.suarte.core.service.impl;

import com.suarte.core.Company;
import com.suarte.core.Contact;
import com.suarte.core.WorkOrder;
import com.suarte.core.WorkOrderDetail;
import com.suarte.core.dao.WorkOrderDao;
import com.suarte.core.service.WorkOrderManager;
import java.util.Date;
import org.appfuse.service.impl.GenericManagerImpl;

import java.util.List;

/**
 * @date   Dec 20, 2010
 * @author Ggutierrez
 */
public class WorkOrderManagerImpl extends GenericManagerImpl<WorkOrder, Long> implements WorkOrderManager {
    WorkOrderDao workOrderDao;

    public WorkOrderManagerImpl(WorkOrderDao workOrderDao) {
        super(workOrderDao);
        this.workOrderDao = workOrderDao;
    }

    public List<WorkOrder> findByDescription(String description) {
        return workOrderDao.findByDescription(description);
    }

    public void store(WorkOrder object) {
        workOrderDao.store(object);
    }

    @Override
    public WorkOrder get(Long id) {
        return workOrderDao.get(id);
    }

    public void deleteDetails(List<WorkOrderDetail> args) {
        workOrderDao.deleteDetails(args);
    }

    public void approve(WorkOrder object) {
        workOrderDao.save(object);
    }

    public List<WorkOrder> findOrders(Long id, Long quotationId, String description, String user, Date date, Company company, Contact contact) {
        return workOrderDao.findOrders(id, quotationId, description, user, date, company, contact);
    }
}
